#include "HanningFilter.h"

template<typename T> HanningFilter<T>::HanningFilter(){
    _value[0] = _value[1] = _value[2] = 0;
    _sampleCount = 0;
}

template<typename T> T HanningFilter<T>::getFilteredValue(T rawValue){
    uint32_t idx = _sampleCount % 3;
    _value[idx] = rawValue;
    _sampleCount++;

    return ((1/4)*(_value[0] + (2*_value[1]) + _value[2]));
}
